no need to disable buffering from Qt in POST requests
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 27 Mar 2025 14:25:49 +0000 (15:25 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 10 Apr 2025 12:55:41 +0000 (14:55 +0200)
data of the files are ready in a memory buffer so Qt will not buffer
them anyway

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/putmultifilejob.cpp

index 99825dd04b11452f6822f5d6ad431e5fd431db48..5c132de33d19babd4091089fdb0ff95b9146834f 100644 (file)
@@ -41,8 +41,6 @@ void PutMultiFileJob::start()
 {
     QNetworkRequest req;
 
-    auto fullSize = 0;
-
     for(const auto &oneDevice : _devices) {
         // Our rate limits in UploadDevice::readData will cause an application freeze if used here.
         // QHttpMultiPart's internal QHttpMultiPartIODevice::readData will loop over and over trying
@@ -53,7 +51,6 @@ void PutMultiFileJob::start()
 
         auto onePart = QHttpPart{};
 
-        fullSize += oneDevice._device->size();
         if (oneDevice._device->size() == 0) {
             onePart.setBody({});
         } else {
@@ -74,9 +71,6 @@ void PutMultiFileJob::start()
         _body.append(onePart);
     }
 
-    req.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute, true);
-    req.setHeader(QNetworkRequest::ContentLengthHeader, fullSize);
-
     sendRequest("POST", _url, req, &_body);
 
     if (reply()->error() != QNetworkReply::NoError) {